<?php
declare (strict_types = 1);

namespace app\user\middleware;

use app\user\model\User;

class Login
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        //
	    if(!cookie('uid')){
			return redirect('/user/login/login');
	    }
		$request->user = User::find(cookie('uid'));
		return $next($request);
    }
}
